package com.nine.pesys.model.service.impl;

import com.nine.pesys.base.BaseSupportImpl;
import com.nine.pesys.model.entity.Equipment;
import com.nine.pesys.model.entity.EquipmentDetail;
import com.nine.pesys.model.service.EquipmentDetailService;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by L先森 on 2014/12/23.
 */
@Service
@Transactional
@SuppressWarnings("all")
public class EquipmentDetailServiceImpl extends BaseSupportImpl<EquipmentDetail> implements EquipmentDetailService{
    @Override
    public List<EquipmentDetail> getTheNum(Equipment equipment, Long equipmentNum) {
        list = this.getSession().createCriteria(EquipmentDetail.class)
                .add(Restrictions.eq("equipment",equipment))
                .add(Restrictions.and(
                        Restrictions.eq("isBorrow",false),
                        Restrictions.eq("isReprice",false),
                        Restrictions.eq("isBroken",false)))
                .setMaxResults(Integer.parseInt(equipmentNum.toString()))
                .list();
        return list;
    }
//            查找

}
